package unit3;

import java.util.Scanner;

/**
 * 电商平台
 */
public class ECommerce {
    public static final String ONE = "查询所有商品";
    public static final String TWO = "根据商品编号查找图书";
    public static final String THREE = "购买书籍";
    public static final String FOUR = "取消购买";
    public static final String FIVE = "查询购买情况";
    public static final String SIX = "退出系统";

    public static void main(String[] args) {
        // 获取用户的输入数据
        Scanner scanner = new Scanner(System.in);

        // 不断循环
        while (true) {
            // 编写主菜单输出语句
            System.out.println("***********商品管理系统*************\r\n"
                    + "1." + ONE + "\r\n"
                    + "2." + TWO + "\r\n"
                    + "3." + THREE + "\r\n"
                    + "4." + FOUR + "\r\n"
                    + "5." + FIVE + "\r\n"
                    + "6." + SIX + "\r\n"
                    + "*****************************************");
            System.out.println("请选择(1-6):");

            // 获取输入
            int value = scanner.nextInt();

            // 根据输入显示
            String str = "您选择了:%s业务\r\n";
            switch (value) {
                case 1:// 处理查询所有书籍的业务
                    System.out.printf(str, ONE);
                    break;
                case 2:// 处理按书籍编号查询
                    System.out.printf(str, TWO);
                    break;
                case 3:// 购买书籍，将书籍加入到用户的购物车中
                    System.out.printf(str, THREE);
                    break;
                case 4:// 删除书籍，从购物车中删除书籍信息
                    System.out.printf(str, FOUR);
                    break;
                case 5:// 显示某个用户购物车中所有的书籍
                    System.out.printf(str, FIVE);
                    break;
                case 6:// 退出当前应用程序
                    System.out.printf(str, SIX);
                    return;
                default:
                    System.out.println("您的选择不正确");
            }
        }
    }
}